home *** CD-ROM | disk | FTP | other *** search
- Path: comma.rhein.de!serpens!not-for-mail
- From: mlelstv@serpens.rhein.de (Michael van Elst)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Messages vs. Semaphores for external clocking
- Date: 10 Apr 1996 16:46:42 +0200
- Organization: dis-
- Message-ID: <4kghki$bog@serpens.rhein.de>
- References: <4ju349$r1e@sparky.navsea.navy.mil> <4jvrqs$hk0@btmpjg.god.bel.alcatel.be> <heinz.17rm@hwg.muc.de> <4kfmes$lle@btmpjg.god.bel.alcatel.be> <4kfuhb$ahh@serpens.rhein.de> <4kg2qq$58l@btmpjg.god.bel.alcatel.be>
- NNTP-Posting-Host: serpens.rhein.de
-
- barnhoorn@nlev00 () writes:
-
- >>No. You stop all other tasks (and with Disable() you even stop
- >>interrupts which is nonsense).
-
- >Agree (I meant Forbid()/Permit()). But 'you stop all other tasks'
- >is wrong. In my Amiga only ONE task is running at the same time.
-
- You stop all other tasks because you prevent that _any_ task preempts
- you instead of just the task that wants to access the shared data.
-
- >When task 1 wants the data, the only thing it has to do is disable
- >multitasking, (which does NOT stop all other tasks because they are
- >already stopped),
-
- It does stop all other tasks because other tasks cannot be scheduled.
-
- > Forbid();
- > local_data=global_data;
- > Permit();
-
- And now make the data some kilobytes in size and watch multitasking
- degrade by several magnitudes.
-
- Using semaphores ensures that you disable multitasking only for a
- minimal period.
-
- >I really only wanted to state that in my opinion, forbid() and permit()
- >is the most easiest, shortest and probably also fastest way to transfer
- >the data from task2 to task1.
-
- ObtainSemaphore()/ReleaseSemaphore() is as easy. It is minimally slower
- (because it calls Forbid() internally) but it doesn't degrade performance
- if the protected operation takes more than coyping a single word.
-
- BTW, using semaphores is also a good way to ensure efficient operation
- if AmigaOS ever supports multiple processors.
-
- Regards,
- --
- Michael van Elst
-
- Internet: mlelstv@serpens.rhein.de
- "A potential Snark may lurk in every tree."
-